//
//  ViewController.m
//  CGRect CGPoint
//
//  Created by iD Student on 6/28/13.
//  Copyright (c) 2013 iD Student. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (void) touchesBegan:(NSSet *) touches withEvent: (UIEvent *) event
{
    UITouch *touch = [touches anyObject];
    CGPoint touchPoint = [touch locationInView:[self view]];
    if(CGRectContainsPoint(imageViewA.frame, touchPoint))
    {
        statusLabel.text = @"Image A is being touched!";
    }
    else if(CGRectContainsPoint(imageViewB.frame, touchPoint))
    {
        statusLabel.text = @"Image B is being touched";
    }
    else{
        statusLabel.text = @" ";
        
    }
}
- (void) touchesEnded:(NSSet *) touches withEvent: (UIEvent *) event
{
    UITouch *touch = [touches anyObject];
    CGPoint touchPoint = [touch locationInView:[self view]];
    if(CGRectContainsPoint(imageViewA.frame, touchPoint))
    {
        statusLabel.text = @"Image A was released!";
    }
    else if(CGRectContainsPoint(imageViewB.frame, touchPoint))
    {
        statusLabel.text = @"Image B was released!";
    }
    else{
        statusLabel.text = @" ";
        
    }
}
@end
